package com.orange.cloud.common.core.msg;

public enum Msg {

    /**
     * 业务成功
     * 0~99
     */
    SUCCESS_0(0, "成功"),
    SUCCESS_1(1, "查无数据"),

    /**
     * 入参校验失败
     * 100-199
     */
    ERROR_CHECK_100(1000, "{0}"),
    ERROR_CHECK_EMPTY(1001, "{0}不能为空"),
    ERROR_CHECK_102(1002, "{0}非法"),
    ERROR_CHECK_103(1003, "{0}不能同时为空"),
    ERROR_CHECK_104(1004, "参数错误：{0}"),

    /**
     * 业务失败
     * 200~299
     */
    ERROR_BUSS_200(2000, "{0}"),
    ERROR_BUSS_201(2001, "{0}-{1}"),//第三方接口返回失败 code-msg
    ERROR_BUSS_202(2002, "第三方数据格式错误"),
    ERROR_BUSS_203(2003, "查询接口配置信息失败"),
    ERROR_BUSS_NOT_FIND(2004, "{0}不存在或已失效"),
    ERROR_BUSS_NOT_ROLE(2005, "{0}，没有权限"),
    ERROR_BUSS_EXIST(2006, "{0}已存在"),
    ERROR_BUSS_DISACCORD(2006, "{0}不一致"),
    ERROR_BUSS_MAX_CALL_NUM(2007, "回调失败,失败{0}次,{1}"),
    ERROR_OPERATE_FAILD(2008, "操作失败"),
    ERROR_PARAM_SIGN(2009, "签名校验不通过"),
    /**
     * 特殊固定编码
     */
    ERROR_CHECK_AUTH_INFO_FAIL(40001, "用户获取认证信息失败"),
    ERROR_CHECK_QW_RETRY_FAIL(40002, "企微登录重试"),
    ERROR_CHECK_WX_AUTH_FAIL(40003, "微信认证失败：{0}"),
    ERROR_CHECK_WX_DECRYPT_FAIL(40004, "微信解密失败：{0}"),
    /**
     * 网关异常
     */
    //token校验
    ERROR_GATEWAY_TOKEN_EMPTY(5001, "认证token为空"),
    ERROR_GATEWAY_TOKEN_VERIFY(5002, "认证校验失败"),
    ERROR_GATEWAY_TOKEN_SCOPE(5003, "认证token异常"),
    ERROR_GATEWAY_TOKEN_PATH(5004, "认证token异常"),
    ERROR_GATEWAY_TOKEN_EXPIRE(5005, "token过期"),
    //地址与token校验不通过
    ERROR_GATEWAY_PATH_ALLOW(5011, "角色没有权限"),
    //ip校验
    ERROR_GATEWAY_IP_ALLOW(5021, "IP没有权限"),
    /**
     * 认证流程异常
     */
    ERROR_AUTH_ACCOUNT_NOT_FOUNT(6001,"账号为空"),
    ERROR_AUTH_USER_NOT_FOUNT(6002,"用户不存在"),
    ERROR_AUTH_MAIN_NOT_FOUNT(6003,"主账号为空"),
    ERROR_AUTH_MAIN_NOT_MATCH(6004,"主账号不匹配"),
    /**
     * 企业微信异常
     */
    ERROR_AUTH_QW_NO_MOBILE(6061,"企业微信未绑定账号{0}"),
    ERROR_AUTH_WX_NO_MOBILE(6062,"微信未绑定账号{0}"),
    ERROR_AUTH_WX_NO_TYPE(6063,"编码不存在：{0}"),

    /**
     * 程序异常
     * -1~ - 99
     */
    ERROR(5000, "程序异常，请稍后重试"),
    ERROR_FLOW(4029, "访问次数过多"),
    ERROR_TIME(4004, "连接超时，请稍后重试"),
    ERROR_THIRD_CONNECT_TIMEOUT(4011, "第三方连接超时，请稍候重试"),
    EXCEPTION_SYS_1(-1, "{0}"),
    EXCEPTION_INSERT_DATABASE(-2, "{0}"),
    EXCEPTION_DELETE_DATABASE(-3, "{0}"),
    EXCEPTION_UPDATE_DATABASE(-4, "更新{0}时异常"),
    EXCEPTION_SELECT_DATABASE(-5, "查询{0}时异常"),
    EXCEPTION_ENCRYPTION(-6, "加密异常"),
    /**
     * 第三方失败
     * -100 ~ -199
     */
    EXCEPTION_THIRD_100(-100, "{0}"),
    EXCEPTION_CALL_THIRD_101(-101, "调用第三方接口异常"),
    EXCEPTION_ANALYSIS_THIRD_102(-102, "解析第三方接口异常");

    private Integer code;
    private String msg;

    Msg(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
